
#ifndef __TERRAIN_H__
#define __TERRAIN_H__

#include "Utilities.h"
#include <vector>

class Terrain
{
public:

	// Constructor
	Terrain(SceneNode *parent);

	// Set the variables
	void SetDimensions(double _width, double _height)
	{ width = _width; height = _height; }

	void SetNodes(uint _nodesWidth, uint _nodesHeight)
	{ nodesWidth = _nodesWidth; nodesHeight = _nodesHeight; }

	// Create the geometry
	void Create(bool forceRedraw = false);

private:

	// Updates the verts array
	bool Update();

	// Dimensions
	double width;
	double height;

	// Nodes - vertices, must be 2^n+1
	uint nodesWidth;
	uint nodesHeight;

	// Vertice heights
	std::vector< std::vector<double> > verts;

	// Ogre node that corresponds to terrain
	SceneNode *node;
};

extern Terrain *terrain;

#endif